/**
 * Created by qifangfei on 2017/9/25.
 */
import React, {Component} from 'react';

import {
    View,
    Text,
    TextInput,
    StyleSheet
} from 'react-native';

import {
    StackNavigator,
    TabNavigator
} from 'react-navigation';

import BaseScene from '../../base/BaseScene'
import HttpUtil from "../../base/http/HttpUtil";

export default class LoginScene extends BaseScene {

    constructor(props) {
        super(props);
        this.userName = "";
        this.password = "";
    }

    render() {
        return (
            <View>

                <TextInput
                           style={styles.textinput} placeholder='QQ号/手机号/邮箱' onChangeText={(text)=>{
                               this.userName = text;}}/>

                <View style={styles.dividerview}>
                    <Text style={styles.divider}></Text>
                </View>

                <TextInput  style={styles.textinput} placeholder='密码'
                           secureTextEntry={true} onChangeText={(text)=>{
                               this.password = text;
                }}/>

                <Text style={styles.logintext} onPress={()=>{

                    let formData = new FormData();
                    formData.append("phone",13777577861);
                    formData.append("password",1234567);
                    let url = "http://app.ishangzu.com/api/common/0108";
                    let params = {'phone':'13777577861','password':'1234567'};
                    HttpUtil.post(url,formData,(responseJSON)=>{alert(responseJSON);})
                    //HttpUtil.get(url,params,(responseData)=>{alert(responseData);})
                }}>登 录</Text>
            </View>
        );
    }
}

const styles  = StyleSheet.create({
    inputview: {
        height: 100,
        color:'#000000'
    },
    textinput: {
        flex: 1,
        fontSize: 16,
        marginTop:20
    },
    dividerview: {
        flexDirection: 'row',
    },
    logintext: {
        height:100,
        width:200,
        fontSize: 25,
        color: '#000000',
        backgroundColor:'red',
        marginTop: 20,
        marginBottom: 10,
        justifyContent:'center',
        alignItems:'center',
        textAlign:'center'
    }
});

